<html>
<head><meta charset="utf-8"><title>async vision - java · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html">async vision - java</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228562889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228562889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228562889">(Mar 03 2021 at 09:43)</a>:</h4>
<blockquote>
<p>and another had just come from the java producers universe</p>
</blockquote>
<p>also, we don't have a character with <strong>Java</strong> background--- is this a blindspot? I know at AWS, Java is pretty common, I imagine the same is true at Google (Android, if nothing else, but probably elsewhere).</p>



<a name="228572353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228572353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228572353">(Mar 03 2021 at 10:52)</a>:</h4>
<p>(lurker comment) Yes, Java is pretty big at Google. Also outside of Android. More interestingly: A lot of Java code at Google is heavily asynchronous.</p>



<a name="228572764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228572764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228572764">(Mar 03 2021 at 10:56)</a>:</h4>
<p>I've been thinking about this</p>



<a name="228572778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228572778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228572778">(Mar 03 2021 at 10:56)</a>:</h4>
<p>I think that Grace (the principal engineer) should be the connection to Java</p>



<a name="228572825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228572825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228572825">(Mar 03 2021 at 10:57)</a>:</h4>
<p><span class="user-mention" data-user-id="224941">@Carl Lerche</span> and I were talking through a sample "Grace status quo" story yesterday from his experience and I realize we already had Grace working on a Java service that was porting some part of it to Rust</p>



<a name="228572842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228572842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228572842">(Mar 03 2021 at 10:57)</a>:</h4>
<p>She also has C++ knowledge, I think that's important, but not exclusive</p>



<a name="228572904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228572904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228572904">(Mar 03 2021 at 10:58)</a>:</h4>
<p>I imagine that whatever Java patterns we want to talk about can come in through that angle</p>



<a name="228573004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228573004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228573004">(Mar 03 2021 at 10:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="368117">Michael Forster</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/async.20vision.20-.20status.20quo/near/228572353">said</a>:</p>
<blockquote>
<p>A lot of Java code at Google is heavily asynchronous.</p>
</blockquote>
<p>this is interesting-- I don't know much about how Java async code looks</p>



<a name="228573069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228573069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228573069">(Mar 03 2021 at 10:59)</a>:</h4>
<p>broke this out into its own topic</p>



<a name="228573146"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228573146" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228573146">(Mar 03 2021 at 11:00)</a>:</h4>
<p><span class="user-mention" data-user-id="368117">@Michael Forster</span> are there some good examples that are public of "async java code" to compare again?</p>



<a name="228574823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228574823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228574823">(Mar 03 2021 at 11:15)</a>:</h4>
<p>The problem here is that a lot of the async code is part of the server side business logic, which is not public. The main original approach is visible in Google's guava library: <a href="https://github.com/google/guava/wiki/ListenableFutureExplained">https://github.com/google/guava/wiki/ListenableFutureExplained</a></p>



<a name="228574861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228574861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228574861">(Mar 03 2021 at 11:15)</a>:</h4>
<p>Guava is Google's most fundamental library, basically our standard library.</p>



<a name="228574944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228574944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228574944">(Mar 03 2021 at 11:16)</a>:</h4>
<p>There is also newer approach that now gets used pervasively, but which isn't public.</p>



<a name="228575483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228575483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228575483">(Mar 03 2021 at 11:21)</a>:</h4>
<p>It's a Guice based mechanism to actually eliminate all asynchronous code from business logic.</p>



<a name="228575757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228575757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228575757">(Mar 03 2021 at 11:24)</a>:</h4>
<p>Instead of writing futures, you more or less decoratively define a graph of synchronous nodes that gets executed asynchronously by a runtime.</p>



<a name="228575867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228575867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228575867">(Mar 03 2021 at 11:25)</a>:</h4>
<p>The general conclusion is that asynchronous code in Java is required for server-side development, but that it's too painful to use.</p>



<a name="228576038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228576038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228576038">(Mar 03 2021 at 11:27)</a>:</h4>
<p>It's important to understand that most server-side business logic is also heavily distributed. Having an RPC in the middle of processing, or stitching together dozens of RPC calls is the norm. And that gets out of hand pretty quickly when writing closures manually.</p>



<a name="228578661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228578661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228578661">(Mar 03 2021 at 11:53)</a>:</h4>
<p>Found an example: <a href="https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/remote/GrpcCacheClient.java">https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/remote/GrpcCacheClient.java</a></p>



<a name="228578732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228578732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Forster <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228578732">(Mar 03 2021 at 11:54)</a>:</h4>
<p>This is one of the more complex examples.</p>



<a name="228654780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/async%20vision%20-%20java/near/228654780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/async.20vision.20-.20java.html#228654780">(Mar 03 2021 at 19:43)</a>:</h4>
<p>I'm pretty ignorant of java in general, but I'm wondering if we do add a persona for this if we should expand to include kotlin as well, which AIUI has its own async/await primitives, separate from java's</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>